function getdata1(){
    var p=new Promise((resolve,reject)=>{
        setTimeout(function(){
            var num=Math.ceil(Math.random()*10);
            console.log('随机数为：'+num);
            if(num>=5){
                resolve(num+':num>=5');
            }else{
                reject(num+':num<5');
            }
        },2000)
    })
    return p

}
function getdata2(){
    var p1=new Promise((resolve,reject)=>{
        setTimeout(function(){
            var num=Math.ceil(Math.random()*10);
            console.log('随机数为：'+num);
            if(num>=5){
                resolve(num+':num>=5');
            }else{
                reject(num+':num<5');
            }
        },2000)
    })
    return p1

}
function getdata3(){
    var p2=new Promise((resolve,reject)=>{
        setTimeout(function(){
            var num=Math.ceil(Math.random()*10);
            console.log('随机数为：'+num);
            if(num>=5){
                resolve(num+':num>=5');
            }else{
                reject(num+':num<5');
            }
        },2000)
    })
    return p2;

}
Promise.all([getdata1(),getdata2(),getdata3()]).then(function(data){
    console.log('success',data);

},function(data){
    console.log('error',data);
})